class TransportImagesController < ApplicationController
  # GET /transport_images
  # GET /transport_images.json
  def index
    @transport_images = TransportImage.where('transport_id =?', params[:tsid])
    @transport_image = TransportImage.new

    respond_to do |format|
      format.js { render layout: false }
    end
  end

  # GET /transport_images/1
  # GET /transport_images/1.json
  def show
    @transport_image = TransportImage.find(params[:id])

    respond_to do |format|
      format.js { render layout: false }
    end
  end

  # GET /transport_images/new
  # GET /transport_images/new.json
  def new
    @transport_image = TransportImage.new

    respond_to do |format|
      format.js { render layout: false }
    end
  end

  # GET /transport_images/1/edit
  def edit
    @transport_image = TransportImage.find(params[:id])
  end

  # POST /transport_images
  # POST /transport_images.json
  def create
    @transport_image = TransportImage.new(params[:transport_image])
    if @transport_image.save
      @transport_id = @transport_image.transport_id
      @data_check = true
    else
      @data_check = false
    end
    
    respond_to do |format|
      format.js { render layout: false }
    end
  end

  # PUT /transport_images/1
  # PUT /transport_images/1.json
  def update
    @transport_image = TransportImage.find(params[:id])
    @transport_image.update_attributes(params[:transport_image])
    @transport_images = TransportImage.where('transport_id =?', params[:tsid])

    respond_to do |format|
      format.js { render layout: false }
    end
  end

  # DELETE /transport_images/1
  # DELETE /transport_images/1.json
  def destroy
    @transport_image = TransportImage.find(params[:id])
    if @transport_image.destroy
      @tr_id = @transport_image.id
      @data_check = true
    else
      @data_check = false
    end

    respond_to do |format|
      format.js { render layout: false }
    end
  end
end
